package com.tianhua.javs.core.factory;

import com.tianhua.javs.client.bean.JavsParamBean;
import com.tianhua.javs.client.model.ParamModel;
import org.springframework.stereotype.Service;

/**
 * Description:
 * date: 2022/2/10
 *
 * @author shenshuai
 * @version 1.0.0
 * @since JDK 1.8
 */
@Service
public class JavsScriptFactory {

    /**
     * 将java 原生的参数模型转换到javs脚本模型上
     * @param paramModel
     * @param javsParamName
     * @return
     */
    public JavsParamBean buildFromParamModel(ParamModel paramModel, String javsParamName){
        JavsParamBean javsParamBean = JavsParamBean.ofInstance(javsParamName);
        javsParamBean.setParamType(paramModel.getParamType());
        javsParamBean.setPackageName(paramModel.getPackageName());
        javsParamBean.setOriginParamName(paramModel.getParamName());
        javsParamBean.setParamPattern(paramModel.getParamRule());
        return javsParamBean;
    }


}
